<template>
  <section>
	  <h1 class="box" @click="doUpload()">hello nuxtjs {{ this.$route.params.id }}</h1>
    <p>{{ result.id }}</p>
    <p>{{ result.description }}</p>
  </section>
</template>

<script>
/*let baseUrl = ''
if (process.env.NODE_ENV === 'development') {
  baseUrl = 'http://api.midoyx.com';
} else if (process.env.NODE_ENV === 'production') {
  baseUrl = 'http://api.midoogame.com';
}*/
//import {oss} from '~/assets/aliyun-oss-sdk-4.4.4.min.js';

import '~/assets/main.css';
export default {
  head () {
    return {
      title: '内容',
      script:[
        {type: 'text/javascript',src:'/aliyun-oss-sdk-4.4.4.min.js'}
      ]
    }
  },
  asyncData (context) {
      return new Promise((resolve,reject)=>{
        setTimeout(()=>{
          resolve({
            result:[
              {
                id:"134",
                description:"this is jack"
              },
              {
                id:"15",
                description:"this is tom"
              }
            ].find(el => el.id==context.params.id)//根据路由筛选出符合要求的数据
          })
        },1000)
      })
      /*console.log(context)*/
  },
  async fetch ({ store, params }) {//在异步回调中必须用store.$axios请求数据
    //console.log(store)
    /*let { data } = await store.$axios.get('/index')
    console.log( data )
    store.commit('SET_LIST', data.list)*/
  },
  methods: {
    doUpload(){
      console.log(new OSS);//OSS
    }
  },
  mounted(){//这里可以用this.$axios请求
  	//
  }
}
</script>

<style>
	h1{
		text-align: center;
		color: #3b8070;
		line-height: 3;
	}
</style>